// =============================================
// Author:		Onur Eker
// Create date: <Create Date,,>
// Description:	<Description,,>
// =============================================

using System;
using System.Collections.Generic;
using System.Text;
using Bosphorus.Migrator.Core;
using Bosphorus.Migrator.Core.MigrationCommand;
using Bosphorus.Migrator.Implementation.MigrationCommand;
using Bosphorus.Migrator.Model;

namespace Bosphorus.Migrator.Facade.DdlSignature.Table
{
    public class AlterTableSignature: CreateTableSignature<AlterTableSignature>
    {
        public AlterTableSignature(ICommand command)
            : base(command)
        {
            
        }

        public AlterTableSignature Alter<TColumn>(string oldName, string newName) where TColumn : Column, new()
        {
            TColumn oldModel = new TColumn();
            oldModel.Name = oldName;

            TColumn newModel = new TColumn();
            newModel.Name = newName;

            return AddAlterSubCommand<Column>(newModel, oldModel);
        }

        public AlterTableSignature Drop<TColumn>(string name) where TColumn : Column, new()
        {
            TColumn column = new TColumn();
            column.Name = name;

            return AddDropSubCommand<Column>(column);
        }
    }
}
